using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using ShopPowerTemplate.IoC;
using ShopPowerTemplate.Entities;
using ShopPowerTemplate.Services.Tests.Properties;

namespace ShopPowerTemplate.Services.Tests
{
    public partial class OrderServiceUtil
    {
	
		static internal IOrderService CreateOrderService()
        {
            IOrderService target = IoCFactory.Resolve<IOrderService>();
            return target;
        }
				#region Order Test
 
        

		public static Order CreateOrder()
        {
            Order result = GetOrder();
            IOrderService service = CreateOrderService();
			service.Add(result);

			result = service.Find(result.Id);
            return result;
        }
		
		public static Order CreateOrderFull()
        {
            Order result = GetOrderFull();
            IOrderService service = CreateOrderService();
			service.Add(result);

			result = service.Find(result.Id);
            return result;
        }
				
        public static Order GetOrder()
        {
            Order result = new Order();
			
            result.Reference = Guid.NewGuid().ToString();

            result.Date = DateTime.Now;

            result.ShippingCost = Math.Round(((decimal)new Random().NextDouble()), 2, MidpointRounding.ToEven);


        	result.Customer = CustomerServiceUtil.CreateCustomer(); 

        	result.OrderState = OrderStateServiceUtil.CreateOrderState(); 
 
            return result;
            
        }
		
        public static Order GetOrderFull()
        {
            Order result = GetOrder();
             
            return result;
            
        }
		
		#endregion Order Test
	

	}
}
